package com.mall.server.service.oms;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.mall.dubbo.api.OmsOrderReturnReasonApi;
import com.mall.model.domain.OmsOrderReturnReason;
import com.mall.model.vo.CommonPage;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

/**
 * @author : xyiaao
 * @createDate : 2022/4/3 9:26
 */
@Service
public class OmsOrderReturnReasonService {

    @DubboReference
    private OmsOrderReturnReasonApi omsOrderReturnReasonApi;


    public void create(OmsOrderReturnReason omsOrderReturnReason) {

        omsOrderReturnReason.setCreateTime(new Date());
        omsOrderReturnReasonApi.save(omsOrderReturnReason);
    }

    public void delete(List<Long> ids) {

        omsOrderReturnReasonApi.removeByIds(ids);
    }

    public CommonPage<OmsOrderReturnReason> page(Integer pageNum, Integer pageSize) {

        Page<OmsOrderReturnReason> pageInfo = omsOrderReturnReasonApi.listPage(pageNum, pageSize);
        return new CommonPage<>(pageInfo);
    }

    public void updateStatus(List<Long> ids, Integer status) {

        omsOrderReturnReasonApi.updateStatus(ids, status);
    }

    public void update(Long id, OmsOrderReturnReason omsOrderReturnReason) {

        omsOrderReturnReasonApi.updateById(omsOrderReturnReason);
    }

    public OmsOrderReturnReason getById(Long id) {

        return omsOrderReturnReasonApi.getById(id);
    }

}
